<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
        <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, minimal-ui" />
        
        <title>Cookie Documentation</title>
        
        <script src="/js/greyspots.js" type="text/javascript"></script>
        <link href="/css/greyspots.css" type="text/css" rel="stylesheet" />
        
        <script src="/js/ace/ace.js" data-ace-base="/js/ace/" type="text/javascript" charset="utf-8"></script>
        <script src="/js/ace/ext-language_tools.js" type="text/javascript"></script>
        <script src="/js/ace/ext-searchbox.js" type="text/javascript"></script>
        
        <script src="doc-library/doc.js" type="text/javascript"></script>
        <link href="doc-library/doc.css" type="text/css" rel="stylesheet" />
    </head>
    <body>
        <gs-jumbo>
            <h1 class="text-center">Cookie</h1>
        </gs-jumbo>
            
        <gs-container min-width="sml;med;lrg">
            <h3>Functions:</h3>
            <pre><code>GS.setCookie(&lt;COOKIE-NAME&gt;, &lt;NEW-VALUE&gt;, &lt;NUMBER-OF-DAYS-UNTIL-EXPIRATION&gt;);<br />
GS.getCookie(&lt;COOKIE-NAME&gt;);</code></pre>
            
            <h3>Description:</h3>
            <p>
                These functions are for getting and setting browser cookies. For documentation about cookies themselves: <a href="https://developer.mozilla.org/docs/Web/API/Document/cookie" target="_blank">MDN</a>, <a href="http://www.w3schools.com/js/js_cookies.asp" target="_blank">W3Schools</a>.
            </p>
            
            <h1>Examples:</h1>
            <div class="doc-example-description">
                <span class="h3">GS.setCookie And GS.getCookie Example:</span><br />
                <p>In this example you set the value of the "doc_cookie" by filling in the "text-cookie-new-value" control and clicking "Set Cookie". Then you can get the value back from the cookie by clicking the "Get Cookie" button. Notice: if you set the cookie then refresh the page then click the "Get Cookie" button the value will still be there.</p>
            </div>
            <gs-doc-example>
                <template for="html" height="10">
                    <gs-text id="text-cookie-new-value"></gs-text>
                    <gs-button onclick="testSetCookie()">Set Cookie</gs-button>
                    <br />
                    <gs-button onclick="testGetCookie()">Get Cookie</gs-button>
                    <br />
                    <div id="result"></div>
                </template>
                <template for="js" height="20">
                    function testSetCookie() {
                        GS.setCookie(
                            'doc_cookie',
                            document.getElementById('text-cookie-new-value').value,
                            2
                        );
                    }
                    function testGetCookie() {
                        document.getElementById('result').textContent =
                            GS.getCookie('doc_cookie');
                    }
                </template>
            </gs-doc-example>
        </gs-container>
    </body>
</html>